package com.shuwen.gcdj.controller.file;

import com.shuwen.gcdj.common.annotation.JWTAuth;
import com.shuwen.gcdj.controller.AuthController;
import com.shuwen.gcdj.service.file.ExcelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/***
 ** Created by ljf
 ** Date:2023/3/13
 */
@Api(tags = "文件管理")
@RestController
@RequestMapping("/document")
@Slf4j
public class ExcelController extends AuthController {

    @Autowired
    private ExcelService excelService;

    @ApiOperation(value = "excel")
    @GetMapping(value = "/importFile")
    @ResponseBody
    @JWTAuth
    public void importFile() {
        excelService.importExcel();
    }

    @ApiOperation(value = "excel文件导出")
    @GetMapping(value = "/exportFile")
    @ResponseBody
    @JWTAuth
    public void exportFile(HttpServletResponse response) {
        excelService.exportExcel(response);
    }

//    @ApiOperation(value = "文件上传")
//    @PostMapping(value = "/uploadFile")
//    @ResponseBody
//    @JWTAuth
//    public CommonResult<String> uploadFile(MultipartFile file) {
//         return excelService.uploadFile(file);
//    }

//    @ApiOperation(value = "excel文件导入")
//    @PostMapping(value = "/previewFile")
//    @ResponseBody
//    @JWTAuth
//    public CommonResult previewFile(MultipartFile file, @RequestBody SelectReq req) {
//        return excelService.previewFile(file,req);
//    }

}
